<template>
  <div class="base_info"
       v-if="Object.keys(goods).length !== 0">
    <div class="info_title">{{goods.title}}</div>
    <div class="info_price">
      <span class="n-price">{{goods.newPrice}}</span>
      <span class="o-pirce">{{goods.oldPrice}}</span>
      <span class="discount"
            v-if="goods.discount">{{goods.discount}}</span>
    </div>
    <div class="info_other">
      <span>{{goods.columns[0]}}</span>
      <span>{{goods.columns[1]}}</span>
      <span>{{goods.services[goods.services.length-1].name}}</span>
    </div>

    <div class="info_service">
      <span class="info_service_item"
            v-for="index in goods.services.length-1"
            :key="index">
        <img :src="goods.services[index-1].icon"
             alt="">
        <span>{{goods.services[index-1].name}}</span>
      </span>
    </div>

  </div>
</template>

<script>
export default {
  name: 'DetailBaseInfo',
  props: {
    goods: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {

    };
  },
  created() {

  },
  mounted() {

  },
  methods: {

  }
};
</script>

<style scoped>
.base_info {
  margin-top: 10px;
  padding: 5px;
}

.info_title {
  font-weight: 500;
}

.info_price {
  display: flex;
  margin-top: 10px;
  align-items: center;
}

.n-price {
  color: var(--color-high-text);
  font-size: 20px;
  margin-right: 10px;
}

.o-pirce {
  font-size: 12px;
  text-decoration: line-through;
  align-self: flex-end;
  margin-right: 10px;
}

.discount {
  background-color: var(--color-tint);
  color: white;
  font-size: 11px;
  padding: 4px;
  border-radius: 8px;
}

.info_other {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #ccc;
  padding-bottom: 5px;
  border-bottom: 2px solid #eee;
}

.info_service {
  padding: 30px 0;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  border-bottom: 2px solid #eee;
}

.info_service_item img {
  width: 9px;
}
</style>
